﻿
Partial Class MainSite
    Inherits System.Web.UI.MasterPage

    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init

    End Sub

    Protected Sub btnLogIn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogIn.Click
        Dim cUser As New OneCall.User.AuthUser(Request, Response)
        If cUser.isActiveSession Then
            cUser.SignOut()
            Response.Redirect("Login.aspx")
        Else
            Response.Redirect("Login.aspx")
        End If
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim cUser As New OneCall.User.AuthUser(Request, Response)
        If cUser.isActiveSession() Then
            btnLogIn.Text = "<span>Logout</span>"
            btnLogIn.OnClientClick = "Login.aspx"
            lblUserFullName.Text = "Welcome, " & cUser.GetUserFullName()
            panelUser.Visible = True
            panelPublic.Visible = False
        Else
            btnLogIn.Text = "<span>Login</span>"
            btnLogIn.OnClientClick = "Login.aspx"
            panelUser.Visible = False
            panelPublic.Visible = True
        End If
    End Sub
End Class

